const http = uni.$u.http
function getConfig(config) {
    return {
        ...config,
        header: {
            Accept: 'application/json'
        }
    }
}
// post请求，获取菜单
export default {
    wxlogin: (data) => http.post('/member/wxlogin', data),
    wxH5login: (data) => http.post('/member/wxH5login', data),
    login: (data, config = {}) => http.post('/member/login', data, getConfig(config)),
    getMemberInfo: (data, config = {}) => http.get('/member/' + data.id),
    updateMemberInfo: (data, config = {}) => http.put('/member/' + data.id, data),
    // 广告轮播
    getBannerList: (data, config = {}) => http.get('/banner/list',data),
    getBannerDetail: (data, config = {}) => http.get('/banner/' + data.id),
    getCategoryList: (data, config = {}) => http.get('/category/list'),
    // 阿姨列表
    getTechnicianList: (data, config = {}) => http.get('/staff/list?status=1&audit_status=2'),
    // 阿姨详情
    getTechnicianDetail: (data, config = {}) => http.get('/staff/' + data.id),
    // 阿姨评论
    getTechnicianCommentList: (data, config = {}) => http.get('/staffComment/list?staff_id=' + data.staff_id),
    getMyCommentList: (data, config = {}) => http.get('/staffComment/list?member_id=' + data.member_id),
    // 创建阿姨评论
    createTechnicianComment: (data, config = {}) => http.post('/staffComment', data),
    // 创建项目评论
    createProjectComment: (data, config = {}) => http.post('/projectComment', data),
    // 阿姨收藏
    getTechnicianCollectList: (data, config = {}) => http.get('/staffCollect/list?member_id=' + data.member_id),
    // 阿姨收藏
    createStaffCollect: (data, config = {}) => http.post('/staffCollect', data, getConfig(config)),
    // 阿姨取消收藏
    deleteStaffCollect: (id, config = {}) => http.delete('/staffCollect/' + id),
    // 阿姨关联的项目
    getTechnicianProjectList: (data, config = {}) => http.get('/staffProject/list?staff_id=' + data.staff_id),
    // 阿姨申请
    getStaffApplyList: (data, config = {}) => http.get('/staff/list?member_id=' + data.member_id),
    createStaffApply: (data, config = {}) => http.post('/staff', data),
    // 项目
    getProjectList: (data = {}, config = {}) => http.get('/project/list?type=' + data.type),
    getProjectDetail: (data, config = {}) => http.get('/project/' + data.id),
    // 项目收藏
    getProjectCollectList: (data, config = {}) => http.get('/projectCollect/list?member_id=' + data.member_id),
    createProjectCollect: (data, config = {}) => http.post('/projectCollect', data,),
    delProjectCollect: (id, config = {}) => http.delete('/projectCollect/' + id),
    // 项目评论
    getProjectCommentList: (data, config = {}) => http.get('/projectComment/list?project_id=' + data.project_id),
    // 城市
    getCityList: (data, config = {}) => http.get('/city/list'),
    // 出行方式
    getTravelModeList: (data, config = {}) => http.get('/travelMode/list'),
    // 地址
    getAddressList: (data, config = {}) => http.get('/address/list?member_id=' + data.member_id),
    getAddressDetail: (data, config = {}) => http.get('/address/' + data.id),
    updateAddress: (data, config = {}) => http.put('/address/' + data.id, data, getConfig(config)),
    createAddress: (data, config = {}) => http.post('/address', data, getConfig(config)),
    deleteAddress: (id, config = {}) => http.delete('/address/' + id),
    getDefaultAddress: (data, config = {}) => http.get('/address/default?member_id=' + data.member_id),
    // 订单
    createOrder: (data, config = {}) => http.post('/order', data),
    getOrderList: (data, config = {}) => http.get('/order/list?member_id=' + data.member_id + '&status=' + data.status),
    getOrderDetail: (data, config = {}) => http.get('/order/' + data.id),
    updateOrder: (data, config = {}) => http.put('/order/' + data.id, data, getConfig(config)),
    deleteOrder: (data, config = {}) => http.delete('/order/' + data.id),
    // 更新订单状态
    updateOrderPayStatus: (data, config = {}) => http.post('/order/updatePayStatus', data),
    // 隐私
    policy: (data, config = {}) => http.get('/policy/' + data),
    policyList: (data, config = {}) => http.get('/policy/list'),
    // 支付
    payment: (data) => http.post('/payment/pay', data),
    paymentH5: (data) => http.post('/paymentH5/pay', data),
    // 获取服务时间
    getServiceTime: (data) => http.get('/staff/serveTime?staff_id=' + data.staff_id),
}
